package com.wicket.okrcomponent.biz.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.wicket.okrcomponent.biz.service.dto.req.*;
import com.wicket.okrcomponent.biz.service.dto.res.*;
import com.wicket.okrcomponent.common.exception.BizException;
import com.wicket.okrcomponent.common.util.CommonFunctionHelper;
import com.wicket.okrcomponent.common.util.RedisUtil;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wicket.okrcomponent.common.exception.Assert;
import com.wicket.okrcomponent.biz.service.nb.NbDashboardOrg;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@Service
public class DashboardOrgServiceImpl
  implements com.wicket.okrcomponent.biz.service.DashboardOrgService {

  @Resource
  private RedisUtil redisUtil;
//@Resource
 //private MCustomFields5Service mCustomFields5Service;
@Resource
  private NbDashboardOrg nbDashboardOrg;
/**
   * D2分析大屏版本类型及名称(公共)[9834]
   * gen by moon at 6/20/2024, 10:18:27 AM
   */
  @Trace(operationName = "D2分析大屏版本类型及名称(公共)")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public AnalysisDashboardVersionTypeAndNameComRespDto analysisDashboardVersionTypeAndNameCom(AnalysisDashboardVersionTypeAndNameComReqDto reqDto){
    
      
      ImplementTenReceivingFieldRespDto receptionServiceRes_3 =null;
//virtualUsage M2接收入参字段  70357
      //ModelCode: receptionService
        ImplementTenReceivingFieldRespDto receptionServiceRes = null;
    ImplementTenReceivingFieldReqDto receptionServiceReq=new ImplementTenReceivingFieldReqDto();
  receptionServiceReq.setCustomField1("高层目标进度");//CUSTOM_CONVENTION//sourceId:1878630_1_70357
receptionServiceReq.setCustomField2("TOP_TARGET_PROGRESS");//CUSTOM_CONVENTION//sourceId:1878631_1_70357
receptionServiceReq.setCustomField3("高层目标得分");//CUSTOM_CONVENTION//sourceId:1878632_1_70357
receptionServiceReq.setCustomField4("TOP_TARGET_SCORE");//CUSTOM_CONVENTION//sourceId:1878633_1_70357
receptionServiceReq.setCustomField5("高层目标达成度");//CUSTOM_CONVENTION//sourceId:1878634_1_70357
receptionServiceReq.setCustomField6("TOP_TARGET_REACH");//CUSTOM_CONVENTION//sourceId:1878635_1_70357
receptionServiceReq.setCustomField7("中层目标进度");//CUSTOM_CONVENTION//sourceId:1878636_1_70357
receptionServiceReq.setCustomField8("MID_TARGET_PROGRESS");//CUSTOM_CONVENTION//sourceId:1878637_1_70357
receptionServiceReq.setCustomField9("中层目标得分");//CUSTOM_CONVENTION//sourceId:1878638_1_70357
receptionServiceReq.setCustomField10("MID_TARGET_SCORE");//CUSTOM_CONVENTION//sourceId:1878639_1_70357
receptionServiceReq.setCustomField11("中层目标达成度");//CUSTOM_CONVENTION//sourceId:1878640_1_70357
receptionServiceReq.setCustomField12("MID_TARGET_REACH");//CUSTOM_CONVENTION//sourceId:1878641_1_70357
if(reqDto!=null){
      receptionServiceReq.setDataType(reqDto.getDataType());//SimpleFieldAssign//sourceId:1878629_1_70357
receptionServiceReq.setTargetCycleContentTypeCode(reqDto.getTargetCycleContentTypeCode());//SimpleFieldAssign//sourceId:1878643_1_70357
    }

    /*M2接收入参字段[8782]  用于特殊方法接收上游入参。 */
    Assert.isNull(receptionServiceReq.getDataType(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-数据点类型不能为空",false);
Assert.isNull(receptionServiceReq.getTargetCycleContentTypeCode(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-关联目标内容类型编码不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField1(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段1不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField2(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段2不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField3(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段3不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField4(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段4不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField5(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段5不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField6(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段6不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField7(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段7不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField8(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段8不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField9(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段9不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField10(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段10不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField11(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段11不能为空",false);
Assert.isNull(receptionServiceReq.getCustomField12(),"D2分析大屏版本类型及名称(公共)-M2接收入参字段-自定义字段12不能为空",false);
      receptionServiceRes = nbDashboardOrg.implementTenReceivingField(receptionServiceReq);
      
      
      
if((reqDto!= null&&  reqDto.getTargetCycleContentTypeCode() !=null && reqDto.getTargetCycleContentTypeCode().equals("TARGET"))) {
        //if(D2分析大屏版本类型及名称(公共).关联目标内容类型编码 等于 目标)  70355
        
if((reqDto!= null&&  reqDto.getDataType() !=null && reqDto.getDataType().equals("PROGRESS_VALUE"))) {
        //if(D2分析大屏版本类型及名称(公共).数据点类型 等于 进度值)  70359
        
//ModelCode: receptionService
        ImplementTenReceivingFieldRespDto receptionServiceRes_2 = null;
    ImplementTenReceivingFieldReqDto receptionServiceReq_1=new ImplementTenReceivingFieldReqDto();
  if(receptionServiceRes!=null){
      receptionServiceReq_1.setDashboradName(receptionServiceRes.getCustomField1());//SimpleFieldAssign//sourceId:1878869_1_70366
receptionServiceReq_1.setDashboradTypeCode(receptionServiceRes.getCustomField2());//SimpleFieldAssign//sourceId:1878868_1_70366
    }
  
    /*M2接收大屏名称与大屏类型[8782]  用于特殊方法接收上游入参。 */
    Assert.isNull(receptionServiceReq_1.getDashboradName(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏名称不能为空",false);
Assert.isNull(receptionServiceReq_1.getDashboradTypeCode(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏类型不能为空",false);
      receptionServiceRes_2 = nbDashboardOrg.implementTenReceivingField(receptionServiceReq_1);
      
      
      receptionServiceRes_3 = receptionServiceRes_2;
      }
else if((reqDto!= null&&  reqDto.getDataType() !=null && reqDto.getDataType().equals("REPORT_SCORE"))){
       //elseif(D2分析大屏版本类型及名称(公共).数据点类型 等于 目标得分)  70360
      
//ModelCode: receptionService
        ImplementTenReceivingFieldRespDto receptionServiceRes_4 = null;
    ImplementTenReceivingFieldReqDto receptionServiceReq_2=new ImplementTenReceivingFieldReqDto();
  if(receptionServiceRes!=null){
      receptionServiceReq_2.setDashboradName(receptionServiceRes.getCustomField3());//SimpleFieldAssign//sourceId:1878869_1_70367
receptionServiceReq_2.setDashboradTypeCode(receptionServiceRes.getCustomField4());//SimpleFieldAssign//sourceId:1878868_1_70367
    }
  
    /*M2接收大屏名称与大屏类型[8782]  用于特殊方法接收上游入参。 */
    Assert.isNull(receptionServiceReq_2.getDashboradName(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏名称不能为空",false);
Assert.isNull(receptionServiceReq_2.getDashboradTypeCode(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏类型不能为空",false);
      receptionServiceRes_4 = nbDashboardOrg.implementTenReceivingField(receptionServiceReq_2);
      
      
      receptionServiceRes_3 = receptionServiceRes_4;
    }
else if((reqDto!= null&&  reqDto.getDataType() !=null && reqDto.getDataType().equals("REACH"))){
       //elseif(D2分析大屏版本类型及名称(公共).数据点类型 等于 达成度)  70361
      
//ModelCode: receptionService
        ImplementTenReceivingFieldRespDto receptionServiceRes_5 = null;
    ImplementTenReceivingFieldReqDto receptionServiceReq_3=new ImplementTenReceivingFieldReqDto();
  if(receptionServiceRes!=null){
      receptionServiceReq_3.setDashboradName(receptionServiceRes.getCustomField5());//SimpleFieldAssign//sourceId:1878869_1_70368
receptionServiceReq_3.setDashboradTypeCode(receptionServiceRes.getCustomField6());//SimpleFieldAssign//sourceId:1878868_1_70368
    }
  
    /*M2接收大屏名称与大屏类型[8782]  用于特殊方法接收上游入参。 */
    Assert.isNull(receptionServiceReq_3.getDashboradName(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏名称不能为空",false);
Assert.isNull(receptionServiceReq_3.getDashboradTypeCode(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏类型不能为空",false);
      receptionServiceRes_5 = nbDashboardOrg.implementTenReceivingField(receptionServiceReq_3);
      
      
      receptionServiceRes_3 = receptionServiceRes_5;
    }
      }
else if((reqDto!= null&&  reqDto.getTargetCycleContentTypeCode() !=null && reqDto.getTargetCycleContentTypeCode().equals("OBJECTIVE"))){
       //elseif(D2分析大屏版本类型及名称(公共).关联目标内容类型编码 等于 指标)  70356
      
if((reqDto!= null&&  reqDto.getDataType() !=null && reqDto.getDataType().equals("PROGRESS_VALUE"))) {
        //if(D2分析大屏版本类型及名称(公共).数据点类型 等于 进度值)  70363
        
//ModelCode: receptionService
        ImplementTenReceivingFieldRespDto receptionServiceRes_6 = null;
    ImplementTenReceivingFieldReqDto receptionServiceReq_4=new ImplementTenReceivingFieldReqDto();
  if(receptionServiceRes!=null){
      receptionServiceReq_4.setDashboradName(receptionServiceRes.getCustomField7());//SimpleFieldAssign//sourceId:1878869_1_70369
receptionServiceReq_4.setDashboradTypeCode(receptionServiceRes.getCustomField8());//SimpleFieldAssign//sourceId:1878868_1_70369
    }
  
    /*M2接收大屏名称与大屏类型[8782]  用于特殊方法接收上游入参。 */
    Assert.isNull(receptionServiceReq_4.getDashboradName(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏名称不能为空",false);
Assert.isNull(receptionServiceReq_4.getDashboradTypeCode(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏类型不能为空",false);
      receptionServiceRes_6 = nbDashboardOrg.implementTenReceivingField(receptionServiceReq_4);
      
      
      receptionServiceRes_3 = receptionServiceRes_6;
      }
else if((reqDto!= null&&  reqDto.getDataType() !=null && reqDto.getDataType().equals("REPORT_SCORE"))){
       //elseif(D2分析大屏版本类型及名称(公共).数据点类型 等于 目标得分)  70364
      
//ModelCode: receptionService
        ImplementTenReceivingFieldRespDto receptionServiceRes_7 = null;
    ImplementTenReceivingFieldReqDto receptionServiceReq_5=new ImplementTenReceivingFieldReqDto();
  if(receptionServiceRes!=null){
      receptionServiceReq_5.setDashboradName(receptionServiceRes.getCustomField9());//SimpleFieldAssign//sourceId:1878869_1_70370
receptionServiceReq_5.setDashboradTypeCode(receptionServiceRes.getCustomField10());//SimpleFieldAssign//sourceId:1878868_1_70370
    }
  
    /*M2接收大屏名称与大屏类型[8782]  用于特殊方法接收上游入参。 */
    Assert.isNull(receptionServiceReq_5.getDashboradName(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏名称不能为空",false);
Assert.isNull(receptionServiceReq_5.getDashboradTypeCode(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏类型不能为空",false);
      receptionServiceRes_7 = nbDashboardOrg.implementTenReceivingField(receptionServiceReq_5);
      
      
      receptionServiceRes_3 = receptionServiceRes_7;
    }
else if((reqDto!= null&&  reqDto.getDataType() !=null && reqDto.getDataType().equals("REACH"))){
       //elseif(D2分析大屏版本类型及名称(公共).数据点类型 等于 达成度)  70365
      
//ModelCode: receptionService
        ImplementTenReceivingFieldRespDto receptionServiceRes_8 = null;
    ImplementTenReceivingFieldReqDto receptionServiceReq_6=new ImplementTenReceivingFieldReqDto();
  if(receptionServiceRes!=null){
      receptionServiceReq_6.setDashboradName(receptionServiceRes.getCustomField11());//SimpleFieldAssign//sourceId:1878869_1_70371
receptionServiceReq_6.setDashboradTypeCode(receptionServiceRes.getCustomField12());//SimpleFieldAssign//sourceId:1878868_1_70371
    }
  
    /*M2接收大屏名称与大屏类型[8782]  用于特殊方法接收上游入参。 */
    Assert.isNull(receptionServiceReq_6.getDashboradName(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏名称不能为空",false);
Assert.isNull(receptionServiceReq_6.getDashboradTypeCode(),"D2分析大屏版本类型及名称(公共)-M2接收大屏名称与大屏类型-大屏类型不能为空",false);
      receptionServiceRes_8 = nbDashboardOrg.implementTenReceivingField(receptionServiceReq_6);
      
      
      receptionServiceRes_3 = receptionServiceRes_8;
    }
    }
AnalysisDashboardVersionTypeAndNameComRespDto retData = new AnalysisDashboardVersionTypeAndNameComRespDto();
  if(receptionServiceRes_3!=null){
      retData.setDashboradName(receptionServiceRes_3.getDashboradName());//SimpleFieldAssign//sourceId:1878922_1
retData.setDashboradTypeCode(receptionServiceRes_3.getDashboradTypeCode());//SimpleFieldAssign//sourceId:1878923_1
    }
  

  
  
return retData;
  }
  //
}
